﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Ehai.Web.Framework.Rules
{
    class RuleHandleFactory
    {
        #region 判断请求的type类型,将请求引导到相应的函数入口

#if DEBUG

        public static string[] GetAllRulesName()
        {
            return new string[]
            {

                CnVerifyCodeRuleHandle.Name,
                CompressRuleHandle.Name,
                DateRuleHandle.Name,
                DeleteRuleHandle.Name,
                DelfileRuleHandle.Name,
                DirRuleHandle.Name,
                DNCOnlineRuleHandle.Name,
                DownFileRuleHandle.Name,
                ExcelReadRuleHandle.Name,     
                ExlToaccessRuleHandle.Name,      
                HtmlFromUrlRuleHandle.Name,   
                HtmlRuleHandle.Name,      
                InsertOrUpdateRuleHandle.Name,        
                InsertSelectRuleHandle.Name,        
                LoginRuleHandle.Name,
                MsgRecoverRuleHandle.Name,
                MsgReplaceRuleHandle.Name,
                RecoverRuleHandle.Name,
                SelectRuleHandle.Name,         
                SqlToExcelRuleHandle.Name,

            };

        }

#endif

        public static IMsgRuleHandle Create(string type)
        {
            IMsgRuleHandle imr = null;
            switch (type)
            {
                case CnVerifyCodeRuleHandle.Name:
                    imr = new CnVerifyCodeRuleHandle();
                    break;
                case CompressRuleHandle.Name:
                    imr = new CompressRuleHandle();
                    break;
                case DateRuleHandle.Name:
                    imr = new DateRuleHandle();
                    break;
                case DeleteRuleHandle.Name:
                    imr = new DeleteRuleHandle();
                    break;
                case DelfileRuleHandle.Name:
                    imr = new DelfileRuleHandle();
                    break;
                case DirRuleHandle.Name:
                    imr = new DirRuleHandle();
                    break;
                case DNCOnlineRuleHandle.Name:
                    imr = new DNCOnlineRuleHandle();
                    break;
                case DownFileRuleHandle.Name:
                    imr = new DownFileRuleHandle();
                    break;
                case ExcelReadRuleHandle.Name:
                    imr = new ExcelReadRuleHandle();
                    break;
                case ExlToaccessRuleHandle.Name:
                    imr = new ExlToaccessRuleHandle();
                    break;
                case HtmlFromUrlRuleHandle.Name:
                    imr = new HtmlFromUrlRuleHandle();
                    break;
                case HtmlRuleHandle.Name:
                    imr = new HtmlRuleHandle();
                    break;
                case InsertOrUpdateRuleHandle.Name:
                    imr = new InsertOrUpdateRuleHandle();
                    break;
                case InsertSelectRuleHandle.Name:
                    imr = new InsertSelectRuleHandle();
                    break;
                case LoginRuleHandle.Name:
                    imr = new LoginRuleHandle();
                    break;
                case MsgRecoverRuleHandle.Name:
                    imr = new MsgRecoverRuleHandle();
                    break;
                case MsgReplaceRuleHandle.Name:
                    imr = new MsgReplaceRuleHandle();
                    break;
                case RecoverRuleHandle.Name:
                    imr = new RecoverRuleHandle();
                    break;
                case SelectRuleHandle.Name:
                    imr = new SelectRuleHandle();
                    break;
                case SqlToExcelRuleHandle.Name:
                    imr = new SqlToExcelRuleHandle();
                    break;

            }
            return imr;

        }

        #endregion

    }
}
